import QtQuick 2.6
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
import QtWebView 1.1

import "../../../Base/UiBase"
import "../../../Base/Config"
import "../../../Base/UiBase/TC" as TC

import Code 1.0

import Cpp.Request 1.0 as Request



MouseArea {
    id:root

    property var news
    property alias _webView: webView

    Rectangle {
        anchors.fill: parent
        color: Color.background
    }
    ColumnLayout {
        anchors.fill: parent
        spacing: 0
        // header
        Rectangle {
            Layout.fillWidth: true
            Layout.preferredHeight: 96 * Size.ratio
            color: Color.foreground

            // back button
            MouseArea {
                width: parent.height
                height: parent.height

                onClicked: root.visible = false
                Rectangle {
                    anchors.fill: parent
                    color: Color.pressed
                    visible: parent.pressed
                }
                SvgzImage {
                    anchors.centerIn: parent
                    sourceSize.width: 80 * Size.ratio
                    sourceSize.height: 96 * Size.ratio
                    source: "../../../../resources/comment/fanhiu01.svg"
                }
            } // end back button

            // title
            Text {
                text: news.iconTitle
                anchors.verticalCenter: parent.verticalCenter
                anchors.horizontalCenter: parent.horizontalCenter
                font.pixelSize: Size.titleFont
            } // end title
            BottomDivider {
            }
        } // end header

        // content view
        WebView {
            id:webView
            Layout.fillWidth: true
            Layout.fillHeight: true
            url: news.contentUrl
        } // end content
    } // end column
}
